<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>${title }</title>
<link rel="stylesheet"
	href="${basePath}/static/bootstrap/css/bootstrap.css" />
<link href="${basePath}/static/css/basic.css" rel="stylesheet"
	type="text/css">
<link href="${basePath}/static/css/login.css" rel="stylesheet"
	type="text/css">
<link href="${basePath}/static/css/list.css" rel="stylesheet"
	type="text/css">
<%--     <link rel="stylesheet" href="${basePath}/static/css/content_leftNav.css"/>
    <link rel="stylesheet" href="${basePath}/static/css/FrontControl.css"/> --%>
<script type="text/javascript" src="${basePath}/static/js/jquery.min.js"></script>
<script type="text/javascript"
	src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript"
	src="${basePath}/static/page/jqPaginator/jqPaginator.js"></script>

</head>
<body>
	<!--头部-->
	<%@include file="/WEB-INF/templates/common/header.jsp"%>
	<!------导航条-->
	<%@include file="/WEB-INF/templates/common/navigation.jsp"%>

	<!--内容部分-->
	<div class="list_main lay_out" class="clearfix">
		<div class="list_DH">
			  <%@include file="/WEB-INF/templates/common/inhospitalDisease.jsp"%>
		</div>
		<div class="list_NR">
			<div class="loc">
				<h3 style="margin: 0">审核质控</h3>
			</div>
			<div class="list_con_table">
				<div class="search_table">
					<ul class="clearfix" style="margin-bottom: 0;">
						<li class="Label_1">出院日期：&nbsp;</li>
						<li class="Label_4"
							style="text-align: left; padding-left: 3px; width: 35%"><input
							class="input_box" style="width: 45%;" type="text"
							name='startTime' id='outHospitalStartDate' value=''
							onFocus="WdatePicker()" /><span>&nbsp;-&nbsp;</span> <input
							class="input_box" type="text" style="width: 45%;" name='endTime'
							id='outHospitalEndDate' value='' onFocus="WdatePicker()" /></li>
						<li class="Label_5">
							<div class="right" style="text-align: right">
								<a onclick="searchQua()">查询</a>

							</div>
						</li>

					</ul>
				</div>
				<table class="Search_tableList" cellpadding="0" cellspacing="0">
					<tr style="height: 20px">

						<td class="tdLabel_4" rowspan="2">人员</td>
						<td class="tdLabel_4" rowspan="2">应审病案数</td>
						<td class="tdLabel_4" colspan="2">实审病案</td>

					</tr>
					<tr>
						<td class="tdLabel_4">完成数</td>
						<td class="tdLabel_4">完成率%</td>

					</tr>

					<tbody id="tbody">
						<tr>
							<td class="tdLabel_5">边鹏</td>
							<td class="tdLabel_5">4495</td>
							<td class="tdLabel_5">1823</td>
							<td class="tdLabel_5">40.56%</td>

						</tr>
						<tr>
							<td class="tdLabel_5">胡硕伟</td>
							<td class="tdLabel_5">3720</td>
							<td class="tdLabel_5">1150</td>
							<td class="tdLabel_5">30.91%</td>

						</tr>
						<tr>
							<td class="tdLabel_5">李艳浩</td>
							<td class="tdLabel_5">387</td>
							<td class="tdLabel_5">387</td>
							<td class="tdLabel_5">100.0%</td>

						</tr>
						<tr>
							<td class="tdLabel_5">孙巧珑</td>
							<td class="tdLabel_5">3989</td>
							<td class="tdLabel_5">2084</td>
							<td class="tdLabel_5">52.24%</td>

						</tr>
						<tr>
							<td class="tdLabel_5">张文革</td>
							<td class="tdLabel_5">1065</td>
							<td class="tdLabel_5">423</td>
							<td class="tdLabel_5">39.72%</td>

						</tr>
					</tbody>
				</table>
			</div>
			<!-- 
        	    <div class="pageList">
		            <ul class="pagination clearfix" id="page_plus"></ul>
		            <div class="pagination">
		                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
		            </div>
        		</div>
         -->
		</div>
	</div>
	<!------页脚部分--------->
	<%@include file="/WEB-INF/templates/common/footer.jsp"%>

	<!--JS部分-->
	<script type="text/javascript">
		$(function() {
			$("#tbody").hide();
		});

		function searchQua() {
			$("#tbody").show();
			//queryQua(0,20);
		}

		function queryQua(currentStartNum, pageSize) {

			var name = $("#name").val();
			var idCard = $("#idCard").val();
			var outHospitalStartDate = $("#outHospitalStartDate").val();
			var outHospitalEndDate = $("#outHospitalEndDate").val();

			if ((outHospitalStartDate == null || outHospitalStartDate == "")
					&& (outHospitalEndDate == null || outHospitalEndDate == '')
					&& (name == null || name == '')
					&& (idCard == null || idCard == '')) {
				alert("请输入查询条件!");
				return;
			}

			jQuery.support.cors = true;
			$
					.ajax({
						type : "get",
						url : "http://localhost:8888/medical-manage/statis/queryMedrecordByAjax",
						data : {
							idCard : idCard,
							outHospitalStartDate : outHospitalStartDate,
							outHospitalEndDate : outHospitalEndDate,
							name : name,
							currentStartNum : currentStartNum,
							pageSize : pageSize
						},
						success : function(data) {
							$("#tbody").html("");

							if (data.success) {
								var hospitalizationNotes = data.data.hospitalizationNotes;
								var medRecordQuery = data.data.medRecordQuery;
								alert(medRecordQuery);
								var totalCounts = medRecordQuery.totalCounts;
								var html = "";
								for (var i = 0; i < hospitalizationNotes.length; i++) {
									var hospitalizationNote = hospitalizationNotes[i];
									html += " <tr>"
											+ "      <td class='tdLabel_5'>"
											+ hospitalizationNote.mr_id
											+ "</td>"
											+ "      <td class='tdLabel_5'>"
											+ hospitalizationNote.name
											+ "</td>"
											+ "      <td class='tdLabel_5'>"
											+ hospitalizationNote.id_number
											+ "</td>"
											+ "      <td class='tdLabel_5'>"
											+ hospitalizationNote.out_hospital_date
											+ "</td>"
											+ "      <td class='tdLabel_5' style='width:280px'><a class='btn' style='padding:6px 2px' target='_blank' href='${basePath}/statics/showMedrecordImage?firstGuid="
											+ hospitalizationNote.first_level_medical_guid
											+ "'>首页预览</a> <a class='btn' target='_blank' href='http://localhost:8888/medical-manage/medrecord/medrecordHomePageManage?firstGuid="
											+ hospitalizationNote.first_level_medical_guid
											+ "'>首页编辑</a></td>" + "  </tr>";
								}

								$("#tbody").html(html);
								page(currentStartNum + 1, totalCounts);

							}

						}
					})

		}

		function page(currentPage, totalCounts) {
			// alert(currentPage+"--"+totalCounts);
			//var totalCounts = 1000;
			var pageSize = 10;
			var visiblePages = 10;
			//var currentPage = 1;
			/* var totalPages = totalCounts%pageSize==0?(totalCounts/pageSize):(totalCounts/pageSize+1); */
			var totalPages = Math.ceil(totalCounts / pageSize);
			$('#page_plus')
					.jqPaginator(
							{

								totalCounts : totalCounts,
								pageSize : pageSize,
								visiblePages : visiblePages,
								currentPage : currentPage,

								first : '<li class="first"><a href="javascript:void(0);">首页</a></li>',
								prev : '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
								next : '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
								last : '<li class="last"><a href="javascript:void(0);">末页</a></li>',
								page : '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
								onPageChange : function(num, type) {

									if (type != 'init') {

										queryQua(num - 1, pageSize);
									}

									$("#totalPage").html(totalCounts);
									$("#currentPage").html(
											num + "/" + totalPages);
								}
							});

		}
	</script>

</body>
</html>